//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CJFFS2DIRECTORY_H__)
#define __CJFFS2DIRECTORY_H__

#include "_CJffs2Directory.h"
#include "nodelist.h"

class CJffs2DirStrEnumerator;

class CJffs2Directory : public _CJffs2Directory
{
public:
    CARAPI Sync();

    CARAPI GetType(
                    /* [out] */ enum FileType * pType);

    CARAPI GetAccessTime(
                    /* [out] */ Int32 * pTime);

    CARAPI SetAccessTime(
                    /* [in] */ Int32 time);

    CARAPI GetModificationTime(
                    /* [out] */ Int32 * pTime);

    CARAPI SetModificationTime(
                    /* [in] */ Int32 time);

    CARAPI GetCreateTime(
                    /* [out] */ Int32 * pTime);

    CARAPI CheckAccessMode(
                    /* [in] */ enum FileAccessMode mode);

    CARAPI GetAccessMode(
                    /* [out] */ enum FileAccessMode * pMode);

    CARAPI SetAccessMode(
                    /* [in] */ enum FileAccessMode mode);

    CARAPI Lookup(
                    /* [in] */ WString name,
                    /* [out] */ IBasicFile * * piBasicFile);

    CARAPI CreateFile(
                    /* [in] */ WString name,
                    /* [in] */ enum FileAccessMode cmode,
                    /* [in] */ Boolean bExclusive,
                    /* [out] */ IBasicFile * * piBasicFile);

    CARAPI DeleteFile(
                    /* [in] */ WString name);

    CARAPI Rename(
                    /* [in] */ WString oldName,
                    /* [in] */ IBasicDirectory * pNewDir,
                    /* [in] */ WString newName);

    CARAPI CreateDirectory(
                    /* [in] */ WString name,
                    /* [in] */ enum FileAccessMode mode);

    CARAPI DeleteDirectory(
                    /* [in] */ WString name);

    CARAPI GetDirEntries(
                    /* [out] */ IWStringEnumerator * * piEntryNameEnumerator);

#if 0

    CARAPI AddFileMonitor(
                    /* [in] */  Boolean   bManualReset,
                    /* [in] */  UInt32  dwInitialState,
                    /* [out] */ IEvent **pEvent);

    CARAPI RemoveFileMonitor(
                    /* [in] */ IEvent *pEvent);
#endif

    CJffs2Directory(n_file file):m_file(file)
    {
    }
    ;
    ~CJffs2Directory();
    friend class CJffs2DirStrEnumerator;

private:
    // TODO: Add your private member variables here
    int CheckFileName(/* [in] */ char * pathname);

    n_file m_file;
    //inline void Lock();
    //inline void Unlock();
};

#endif //!(__CKTFSDIRECTORY_H__)
